package com.example.myapplication.lol.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;

import com.example.myapplication.lol.base.BaseVpAdapter;
import com.example.myapplication.lol.bean.TabBean;
import com.example.myapplication.lol.ui.FragmentLol12;
import com.example.myapplication.lol.ui.FragmentLol13;
import com.example.myapplication.lol.ui.FragmentLol11;
import com.example.myapplication.lol.ui.FragmentLol14;
import com.example.myapplication.lol.ui.FragmentLol15;
import com.example.myapplication.lol.ui.FragmentLol16;
import com.example.myapplication.lol.ui.FragmentLol17;
import com.example.myapplication.lol.ui.FragmentLol18;


public class VpFragmentAdapter extends  BaseVpAdapter<TabBean> {

    private FragmentLol11 fragmentLol11 = new FragmentLol11();
    private FragmentLol12 fragmentLol12 = new FragmentLol12();
    private FragmentLol13 fragmentLol13 = new FragmentLol13();
    private FragmentLol14 fragmentLol14 = new FragmentLol14();
    private FragmentLol15 fragmentLol15 = new FragmentLol15();
    private FragmentLol16 fragmentLol16 = new FragmentLol16();
    private FragmentLol17 fragmentLol17 = new FragmentLol17();
    private FragmentLol18 fragmentLol18 = new FragmentLol18();
public VpFragmentAdapter(@NonNull FragmentManager fm) { super(fm); }

@Override
protected Fragment createFragment(int position) {
    Fragment fragment = null;
    TabBean bean = getData(position);
    if (bean.getType() == TabBean.TYPE_ARTICLE){
        switch (position){
            case 0:
                return fragmentLol11;
            case 1:
                return fragmentLol12;
            case 2:
                return fragmentLol13;
            case 3:
                return fragmentLol14;
            case 4:
                return fragmentLol15;
            case 5:
                return fragmentLol16;
            case 6:
                return fragmentLol17;
            case 7:
                return fragmentLol18;
        }
    }
    return fragment;
}

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) { return getData(position).getTitle(); }
}